<?php
require_once './libs/smarty.conf.php';
require_once './libs/magic.const.php';

header('Content-Type: text/javascript');

$script = (isset($_GET['script'])) ? $_GET['script'] : NULL;
if (($script !== NULL) && (strpos($script, '.') === false)) {
  $name = "javascript/dependencies/dep_$script.tpl";
  if ($smarty->template_exists($name)) {
    $smarty->display($name);
  }
  $name = "javascript/$script.tpl";
  if ($smarty->template_exists($name)) {
    $smarty->display($name);
  }
}
?>
